﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
namespace BanHangCshap.Class
{
    class ThiCongThanhPham:Database
    {
       
        private string _mahang;
        public string mahang
        {
            get
            {
                return _mahang;
            }
            set
            {
                _mahang = value;
            }
        }



        private double _prima;
        public double prima
        {
            get
            {
                return _prima;
            }
            set
            {
                _prima = value;
            }
        }
        private double _vanchuyen;
        public double vanchuyen
        {
            get
            {
                return _vanchuyen;
            }
            set
            {
                _vanchuyen = value;
            }
        }
        private double _nuocson;
        public double nuocson
        {
            get
            {
                return _nuocson;
            }
            set
            {
                _nuocson = value;
            }
        }
        private double _pvc;
        public double pvc
        {
            get
            {
                return _pvc;
            }
            set
            {
                _pvc = value;
            }
        }
        private double _keo;
        public double keo
        {
            get
            {
                return _keo;
            }
            set
            {
                _keo = value;
            }
        }
        private double _cong;
        public double cong
        {
            get
            {
                return _cong;
            }
            set
            {
                _cong = value;
            }
        }
        private double _giavon;
        public double giavon
        {
            get
            {
                return _giavon;
            }
            set
            {
                _giavon = value;
            }
        }
        private double _giabansi;
        public double giabansi
        {
            get
            {
                return _giabansi;
            }
            set
            {
                _giabansi = value;
            }
        }
        private double _giabanle;
        public double giabanle
        {
            get
            {
                return _giabanle;
            }
            set
            {
                _giabanle = value;
            }
        }
        public ThiCongThanhPham() { }
        public Boolean xoaBoSanPhamThiCong(string mahang)
        {
            string sql = "delete ThiCongThanhPham where mahang = '" + mahang + "'";
            return executeQueryTrans(sql);
        }
        public Boolean themBoSanPhamThiCong()
        {
            string[] field = {  "mahang", "prima","vanchuyen","nuocson","pvc","keo","cong", "giavon","giabansi","giabanle" };
            object[] value = { (object)mahang, (object)prima, (object)vanchuyen, (object)nuocson, (object)pvc, (object)keo, (object)cong, (object)giavon, (object)giabansi, (object)giabanle};
            return addTrans("ThiCongThanhPham", field, value);
        }
        public DataTable layDSThiCongThanhPham()
        {
            string sql = "select b.maloai,tenloai,a.mahang, tenhang,dvt, prima,vanchuyen,nuocson,pvc,keo,cong,giavon,giabansi,giabanle from ThiCongThanhPham a left join HangHoa b on a.mahang = b.mahang left join LoaiHang c on b.maloai= c.maloai";
            return getDataTable(sql);
        }

    }
}
